const common = {
	'/common/upload': {
		post: {
			summary: '单张图片上传',
			description: '图片直接上传',
			tags: ['公共接口'],
			requestBody: {
				required: true,
				content: {
					'multipart/form-data': {
						schema: {
							type: 'object',
							properties: {
								file: {
									type: 'string',
									format: 'binary',
									required: true,
									description: '图片文件'
								}
							}
						}
					}
				}
			},
			responses: {
				200: {
					description: '成功',
					content: {
						'application/json': {
							schema: {
								type: 'string',
								properties: {
									file: {
										type: 'string',
										description: '返回的路径信息'
									}
								}
							}
						}
					}
				},
				'40xx': {
					description: '失败',
					content: {
						'application/json': {
							schema: {
								type: 'string'
							}
						}
					}
				}
			}
		}
	},
	'/common/m-upload': {
		post: {
			summary: '多个图片上传',
			description: '',
			tags: ['公共接口'],
			requestBody: {
				required: true,
				content: {
					'multipart/form-data': {
						schema: {
							type: 'object',
							properties: {
								file: {
									type: 'string',
									format: 'binary',
									required: true,
									description: '图片文件'
								}
							}
						}
					}
				}
			},
			responses: {
				200: {
					description: '成功',
					content: {
						'application/json': {
							schema: {
								type: 'string',
								properties: {
									file: {
										type: 'string',
										description: '返回的路径信息'
									}
								}
							}
						}
					}
				},
			}
		}
	},
	'/common/max-upload': {
		post: {
			summary: '设置上传文件的数量',
			description: 'form-data 表单中可以有多个文件  有多少个form-data的key，数组就有多个',
			tags: ['公共接口'],
			requestBody: {
				content: {
					'multipart/form-data': {
						schema: {
							type: 'object',
							properties: {
								photos: {
									type: 'string',
									format: 'binary',
									required: true,
									description: '头像图片文件'
								},
								multer: {
									type: 'string',
									format: 'binary',
									description: '其他图片文件'
								},
								multerpart: {
									type: 'string',
									description: '其他参数'
								}
							}
						}
					}
				}
			},
			responses: {
				200: {
					description: '成功',
					content: {
						'application/json': {
							schema: {
								type: 'string',
								properties: {
									file: {
										type: 'string',
										description: '返回的路径信息'
									}
								}
							}
						}
					}
				},
			}
		}
	},
	'/common/form-upload': {
		post: {
			summary: '表单提交',
			description: '不处理文件，直接处理表单提交',
			tags: ['公共接口'],
			requestBody: {
				content: {
					'multipart/form-data': {
						schema: {
							type: 'object',
							properties: {
								multerpart: {
									type: 'string',
									description: '其他参数'
								}
							}
						}
					}
				}
			},
			responses: {
				200: {
					description: '成功',
					content: {
						'application/json': {
							schema: {
								type: 'string',
								properties: {
									file: {
										type: 'string',
										description: '返回的路径信息'
									}
								}
							}
						}
					}
				},
			}
		}
	},
	'/common/check-file': {
		get: {
			summary: '检查文件的MD5',
			description: '',
			tags: ['公共接口'],
			parameters: [
				{
					name: 'fileName',
					in: 'query',
					description: '文件名称',
					required: true,
					schema: {
						type: 'string'
					}
				},
				{
					name: 'fileMd5Value',
					in: 'query',
					description: '文件MD5值',
					required: true,
					schema: {
						type: 'string'
					}
				}
			],
			responses: {
				200: {
					description: '成功',
					content: {
						'application/json': {
							schema: {
								type: 'object',
								properties: {
									stat: {
										type: 'number',
          enum: [0,1],
										description: '状态码'
									},
									chunkList: {
										type: 'array',
										description: '完成上传的切片',
          items: {
           type: 'string'
          }
									},
								}
							}
						}
					}
				}
			}
		}
	},
	'/common/merge': {
		get: {
			summary: '上传完成后合并文件',
			tags: ['公共接口'],
			parameters: [
				{
					name: 'fileName',
					in: 'query',
					description: '文件名称',
					required: true,
					schema: {
						type: 'string'
					}
				},
				{
					name: 'fileMd5Value',
					in: 'query',
					description: '文件MD5值',
					required: true,
					schema: {
						type: 'string'
					}
				},
				{
					name: 'size',
					in: 'query',
					description: '文件大小',
					required: true,
					schema: {
						type: 'string'
					}
				}
			],
			responses: {
				200: {
					description: '成功',
					content: {
						'application/json': {
							schema: {
								type: 'object',
								properties: {
									name: {
										type: 'string',
										description: '文件名称'
									},
									index: {
										type: 'number',
										description: '第几个切片'
									},
									fileMd5Value: {
										type: 'string',
										description: '文件MD5值'
									},
								}
							}
						}
					}
				}
			}
		}
	},
	'/common/upload-all': {
		post: {
			summary: '文件切片上传',
			tags: ['公共接口'],
			parameters: [
				{
					name: 'fileName',
					in: 'query',
					description: '文件名称',
					required: true,
					schema: {
						type: 'string'
					}
				},
				{
					name: 'fileMd5Value',
					in: 'query',
					description: '文件MD5值',
					required: true,
					schema: {
						type: 'string'
					}
				},
				{
					name: 'size',
					in: 'query',
					description: '文件大小',
					required: true,
					schema: {
						type: 'string'
					}
				}
			],
			responses: {
				200: {
					description: '成功',
					content: {
						'application/json': {
							schema: {
								type: 'string',
								properties: {
									file: {
										type: 'string',
										description: '返回的路径信息'
									}
								}
							}
						}
					}
				},
			}
		}
	}
}

module.exports = common
